<?php
include dirname(__FILE__).'/s_user-verify.php';
include dirname(__FILE__).'/function.php';
$ret=getSUserById($_SESSION['s_user_id']);
$row;
if ($ret) {
	if(mysql_num_rows($ret)>0) {
		$row = mysql_fetch_array($ret);
	}
}else {
	alertInfo("查询出错",getHost().'/front-show/home.php');
}

?>
<html>
	<head>
	<title>用户编辑</title>
	<link rel="stylesheet" type="text/css" href="../css/cmxform.css">
	<?php include dirname(dirname(dirname(__FILE__))).'/include/common-header.php';?>
	<script type="text/javascript" src="../../js/jquery.js"></script>
	<script type="text/javascript" src="../../js/jquery.validate.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
	$("#update-form").validate({
		rules: {
			username: {
				required: true,
				minlength: 4
			},
			student_id: {
				required: true
			},
			department:{
			    required:true
			},
			grade:{
			   required:true
			},
			user_real_name:{
			    required:true
			},
			phone:{
				required:true
			},
			
		},
		messages: {
		
			username: {
				required: "请填写用户账号",
				minlength: "用户账号长度至少为4"
			},
			student_id: {
			 required:"请填写学号"
			 },
			 department:{
			  
			  required:"请填写院系"
			 
			 },
			 grade:{
			   required:"请填写年级"
			 },
			 
			 user_real_name:{
			     required:"请填写真实姓名"
			 },
			 phone:{
				 required:"请填写联系方式"
			 },
		}
	});
	});
	</script>
	</head>
	<body>
		      <form class="form-horizontal col-md-offset-3" id="update-form" role="form" method="post" action="updateSUser.php">
			  <div class="form-group">
			    <label for="username" class="col-sm-2 control-label">用户名</label>
			    <div class="col-sm-10">
			      <input required style="width:60%" type="text" value=<?php echo '"'.$row['username'].'"'; ?>  disabled class="form-control" id="username" name="username" placeholder="用户名" >
			   	 <p id="help-block" class="help-block" style="display:none"></p>
			    </div>
			  </div>		
			    <div class="form-group">
				    <label for="student_id" class="col-sm-2 control-label">学号</label>
				    <div class="col-sm-10">
				      <input style="width:60%" type="text" name="student_id" class="form-control normal-input" id="student_id" placeholder="学号" value=<?php echo '"'.$row["student_id"].'"'; ?>> 
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="department" class="col-sm-2 control-label">学院</label>
				    <div class="col-sm-10">
				      <input style="width:60%" type="text" name="department" class="form-control normal-input" id="department" placeholder="学院" value=<?php echo '"'.$row["department"].'"'; ?>>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="grade" class="col-sm-2 control-label">年级</label>
				    <div class="col-sm-10">
				      <input style="width:60%" type="text" name="grade" class="form-control normal-input" id="grade" placeholder="年级" value=<?php echo '"'.$row["grade"].'"'; ?>>
				    </div>
				  </div>
				  <div class="form-group">
				    <label  for="user_real_name" class="col-sm-2 control-label">姓名</label>
				    <div class="col-sm-10">
				      <input required style="width:60%" type="text" name="user_real_name" class="form-control normal-input" id="user_real_name" placeholder="姓名" value=<?php echo '"'.$row["user_real_name"].'"'; ?>>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="sex" class="col-sm-2 control-label">性别</label>
				    <div class="col-sm-10">
				       <select style="width:60%" name="sex" id="sex" class="form-control">
				       <?php
				       		if($row["sex"]=="女"){
								echo ' <option value="男">男</option>
				     				 <option value="女" selected >女</option>';
				       		}
				       		else {
				       			echo  '<option value="男">男</option>
				      				 <option value="女">女</option>';
				       		} 
				       ?>
				      </select>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="phone" class="col-sm-2 control-label">联系方式</label>
				    <div class="col-sm-10">
				      <input required style="width:60%" type="text" name="phone" class="form-control normal-input" id="phone" placeholder="手机或电话" value=<?php echo '"'.$row["phone"].'"'; ?>>
				    </div>
				  </div>
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <input class="btn btn-primary" id="submit-btn" type="submit" value="修改">
			    </div>
			  </div>
			  <input name="submited" type="hidden" value="1">
			</form>
	</body>
</html>